﻿using System.Collections.Generic;
using Gp.Scripts.Database;
using UnityEngine;

namespace Gp.Scripts.Core {
    public class ItemCode {
        public static readonly List<ItemCode> Codes = new();

        private ItemCode(string label, int id) {
            Label = label;
            Codes.Add(this);
            Id = id;
        }

        public int Id { get; }
        public string Label { get; }


        public Sprite Thumb {
            get {
                LevelObjectConfigDatabase database = LevelObjectConfigDatabase.Instance;
                return this.Id >= database.itemThumb.Length ? null : database.itemThumb[this.Id];
            }
        }

        

        public static readonly ItemCode Weapon = new("武器", 0);
        public static readonly ItemCode Armor = new("护甲", 1);
        public static readonly ItemCode Consumables = new("药物", 2);
        public static readonly ItemCode Book = new("书籍", 3);
        public static readonly ItemCode Misc = new("杂项", 4);
    }
}